package com.expert.conrtoller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.expert.dto.AddScoreDTO;
import com.expert.result.Result;
import com.expert.service.ScoreDetailedService;
import com.expert.vo.ScoreMoreInfo;
import com.expert.vo.ShowScoreDataVo;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: ScoreController
 * @Author: cxs
 * @Date: 2024/03/30 17:36
 * @Description:
 **/
@RestController
@RequestMapping("/score")
@Slf4j
public class ScoreController {
    @Autowired
    ScoreDetailedService scoreDetailedService;

    /**
     * 添加项目评价信息
     * @param addScoreDTO 项目评价
     * @return result
     */
    @PostMapping("/addScore")
    public Result addScore(@RequestBody AddScoreDTO addScoreDTO){
      log.info("项目评价信息");
      this.scoreDetailedService.addScore(addScoreDTO);
      return Result.success();
    }


    /**
     * 查询评分列表
     * @param page
     * @param pageSize
     * @param expertName
     * @param projectName
     * @return
     */
    @GetMapping("/showScore")
    public Result<Page<ShowScoreDataVo>> showScoreList(Integer page, Integer pageSize, String expertName, String projectName){
        log.info("查询评分列表");
        Page<ShowScoreDataVo> showScoreDataVos=this.scoreDetailedService.showScoreList(page,pageSize,expertName,projectName);
        return Result.success(showScoreDataVos);
    }

    @GetMapping("/showMore/{id}")
    public Result<ScoreMoreInfo> showScoreMore(@PathVariable("id") Long id){
        ScoreMoreInfo scoreMoreInfo=this.scoreDetailedService.showMore(id);
        return Result.success(scoreMoreInfo);
    }
}
